package com.applcn.shop.constant;

import com.baomidou.mybatisplus.core.enums.IEnum;

/**
 * com.applcn.shop.constant
 * Description:
 *
 * @author: 大妖怪
 * @date: 2020-01-19 18:14
 */
public enum ShopVersionEnum implements IEnum<Integer> {

    /**
     * 免费版
     */
    FREE(0, "免费版"),

    VERSION1(1, "付费方案1");

    private int code;
    private String desc;

    ShopVersionEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ShopVersionEnum getVersion(int code){
        for (ShopVersionEnum shopVersionEnum:ShopVersionEnum.values()) {
            if (shopVersionEnum.getCode() == code) {
                return shopVersionEnum;
            }
        }
        return null;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public Integer getValue() {
        return this.getCode();
    }
}
